Sends the event to all channel subscribers, waiting at most waitTime
Syntax
Parameters
- waitTime
- eventName
- arguments
Example
Library/Library.Test/TestIpcChannel.cs
C# | Copy Code |
---|
using (IpcEventChannel ch1 = new IpcEventChannel(_registrar, _channel))
using (IpcEventChannel sender = new IpcEventChannel(_registrar, _channel))
{
ch1.StartListening("ch1");
ManualResetEvent ready = new ManualResetEvent(false);
ManualResetEvent die = new ManualResetEvent(false);
ch1["Message"].OnEvent += delegate(object o, IpcSignalEventArgs e)
{
ready.Set();
die.WaitOne();
Thread.CurrentThread.Abort();
};
sender.Broadcast(100, "Message");
Assert.IsTrue(ready.WaitOne(1000, false));
sender.EnableAsyncSend();
sender.Broadcast(0, "Message");
die.Set();
sender.StopAsyncSending(true, 1000);
ch1.StopListening();
} |
VB.NET | Copy Code |
---|
Using ch1 As New IpcEventChannel(_registrar, _channel)
Using sender As New IpcEventChannel(_registrar, _channel)
ch1.StartListening("ch1")
Dim ready As New ManualResetEvent(False)
Dim die As New ManualResetEvent(False)
ch1("Message").OnEvent += Function(o As Object, e As IpcSignalEventArgs) Do
ready.[Set]()
die.WaitOne()
Thread.CurrentThread.Abort()
End Function
sender.Broadcast(100, "Message")
Assert.IsTrue(ready.WaitOne(1000, False))
sender.EnableAsyncSend()
sender.Broadcast(0, "Message")
die.[Set]()
sender.StopAsyncSending(True, 1000)
ch1.StopListening()
End Using
End Using |
Requirements
Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7
See Also